#!/usr/bin/python
# -*- coding: utf-8 -*-
# @version        : 1.0
# @Create Time    : 2025/4/1 11:11
# @File           : user
# @IDE            : PyCharm
# @desc           : 描述

from typing import Optional, Union
from pydantic import BaseModel, ConfigDict, computed_field
from core.data_types import DatetimeStr


class TeamSearch(BaseModel):
    model: Optional[str] = None
    factory: Optional[str] = None
    plant: Optional[str] = None
    workshop: Optional[str] = None
    code: Optional[str] = None
    group: Optional[str] = None

    pageIndex: Union[int, str]
    pageSize: Union[int, str]

    @computed_field
    def page(self) -> int:
        return int(self.pageIndex)
    
    @computed_field
    def limit(self) -> int:
        return int(self.pageSize)

class TeamUserSearch(BaseModel):
    jobNo: Optional[str] = None
    jobCode: Optional[str] = None
    deptCode: Optional[str] = None

    pageIndex: Union[int, str]
    pageSize: Union[int, str]

    @computed_field
    def page(self) -> int:
        return int(self.pageIndex)
    
    @computed_field
    def limit(self) -> int:
        return int(self.pageSize)